package com.jsaber.postaware;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;

/**
 * @author : zijia
 * @Description: TODO
 * @date Date : 2021-07-02 10:26
 */
public class MyBeanFactoryAware implements BeanFactoryAware {
    private BeanFactory beanFactory;

    public Object getService(String code) {
        return beanFactory.getBean(code);
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        System.out.println("MyBeanFactoryAware beanFactory");
        this.beanFactory = beanFactory;
    }
}
